package com.ruoyi.deeplearn.service.impl;

import java.util.List;

import cn.hutool.core.util.IdUtil;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.deeplearn.mapper.DeepTagMapper;
import com.ruoyi.deeplearn.domain.DeepTag;
import com.ruoyi.deeplearn.service.IDeepTagService;

/**
 * 标签Service业务层处理
 * 
 * @author rww
 * @date 2022-12-10
 */
@Service
public class DeepTagServiceImpl implements IDeepTagService 
{
    @Autowired
    private DeepTagMapper deepTagMapper;

    /**
     * 查询标签
     * 
     * @param tagId 标签主键
     * @return 标签
     */
    @Override
    public DeepTag selectDeepTagByTagId(Long tagId)
    {
        return deepTagMapper.selectDeepTagByTagId(tagId);
    }

    /**
     * 查询标签列表
     * 
     * @param deepTag 标签
     * @return 标签
     */
    @Override
    public List<DeepTag> selectDeepTagList(DeepTag deepTag)
    {
        return deepTagMapper.selectDeepTagList(deepTag);
    }

    /**
     * 新增标签
     * 
     * @param deepTag 标签
     * @return 结果
     */
    @Override
    public int insertDeepTag(DeepTag deepTag)
    {
        deepTag.setTagId(IdUtil.getSnowflakeNextId());
        deepTag.setCreateTime(DateUtils.getNowDate());
        return deepTagMapper.insertDeepTag(deepTag);
    }

    /**
     * 修改标签
     * 
     * @param deepTag 标签
     * @return 结果
     */
    @Override
    public int updateDeepTag(DeepTag deepTag)
    {
        deepTag.setUpdateTime(DateUtils.getNowDate());
        return deepTagMapper.updateDeepTag(deepTag);
    }

    /**
     * 批量删除标签
     * 
     * @param tagIds 需要删除的标签主键
     * @return 结果
     */
    @Override
    public int deleteDeepTagByTagIds(Long[] tagIds)
    {
        return deepTagMapper.deleteDeepTagByTagIds(tagIds);
    }

    /**
     * 删除标签信息
     * 
     * @param tagId 标签主键
     * @return 结果
     */
    @Override
    public int deleteDeepTagByTagId(Long tagId)
    {
        return deepTagMapper.deleteDeepTagByTagId(tagId);
    }
}
